package cn.tradewin.advisor.mail.services;

import java.io.File;

import javax.activation.DataSource;

import org.apache.commons.mail.Email;

import cn.tradewin.advisor.mail.MailMessageHeaders;

public interface MailService <T extends Email> {
	/**
	 * send a HTML message.
	 *
	 * @param headers  the mail headers
	 * @param htmlBody the mail body (HTML based)
	 *
	 * @return true if mail successfull send
	 */
	boolean sendHtmlMail(MailMessageHeaders headers, String htmlBody);

	/**
	 * send a HTML message.
	 *
	 * @param headers	 the mail headers
	 * @param htmlBody	the mail body (HTML based)
	 * @param attachments array of files to attach at this mail
	 *
	 * @return true if mail successfull send
	 */
	boolean sendHtmlMail(MailMessageHeaders headers, String htmlBody, File... attachments);

	/**
	 * send a HTML message.
	 *
	 * @param headers	 the mail headers
	 * @param htmlBody	the mail body (HTML based)
	 * @param dataSources array of data sources to attach at this mail
	 *
	 * @return true if mail successfull send
	 */
	boolean sendHtmlMail(MailMessageHeaders headers, String htmlBody, DataSource... dataSources);

	/**
	 * send a plain text message.
	 *
	 * @param headers the mail headers
	 * @param body	the mail body (text based)
	 *
	 * @return true if mail successfull send
	 */
	boolean sendPlainTextMail(MailMessageHeaders headers, String body);

	/**
	 * send a plain text message.
	 *
	 * @param headers	 the mail headers
	 * @param body		the mail body (text based)
	 * @param attachments array of files to attach at this mail
	 *
	 * @return true if mail successfull send
	 */
	boolean sendPlainTextMail(MailMessageHeaders headers, String body, File... attachments);

	/**
	 * send a plain text message.
	 *
	 * @param headers	 the mail headers
	 * @param body		the mail body (text based)
	 * @param dataSources array of data sources to attach at this mail
	 *
	 * @return true if mail successfull send
	 */
	boolean sendPlainTextMail(MailMessageHeaders headers, String body, DataSource... dataSources);
}
